import statementApi from "@/api/statement/statement";
import FileAPI from "@/api/file/index";
import { useDateRanges } from "@/utils/useDateRanges";

// 导出表格
export function downLoad(queryParams: any, reportType: any, reportName: any) {
  let data = { reportParam: queryParams, reportType: reportType };
  statementApi
    .downloadReport(data)
    .then((data: any) => {
      let name = reportName + "_" + useDateRanges().getDate() + ".xlsx";
      FileAPI.downloadFile(data as any, name).then(() => {
        ElMessage.success(`下载文件：${name}`);
      });
    })
    .finally(() => {});
}
// 历史下载
export function historyDownLoad(filePath: any, fileName: any) {
  FileAPI.downloadFile(filePath, fileName).then(() => {
    ElMessage.success(`下载文件：${fileName}`);
  });
}
